import request from '@/http/request'
const api = '/bf-user';

const systemApi = {
  auth: {
    getDepartmentTree: () => request.get(`${api}/department/getDepartmentTree`).then(res => res?.data), // 获取部门组织结构数据
    getUserRole: (param) => request.post(`${api}/user/getUserRole`, param).then(res => res?.data), // 通过部门编号获取用户及权限信息
    getRoleAndUserRole: (userIds) => request.get(`${api}/role/getRoleAndUserRole?userIds=${userIds}`).then(res => res?.data), // 获取角色与用户的绑定关系
    updateBatchUserRole: (param) => request.post(`${api}/role/updateBatchUserRole`, param).then(res => res?.data),// 更新用户角色绑定关系
  },
  role: {
    getRolePage: (param) => request.post(`${api}/role/getRolePage`, param).then(res => res?.data), // 获取所有角色
    roleCreate: (param) => request.post(`${api}/role/create`, param).then(res => res?.data), // 新增角色
    getPermissionAndRolePermission: (roleId) => request.get(`${api}/role/getPermissionAndRolePermission?roleId=${roleId}`), // 获取所有权限与角色的绑定关系
    getCompanyPostMsg: (roleId) => request.get(`${api}/role/getCompanyPostVo?roleId=${roleId}`).then(res => res?.data), // 获取岗位信息
    updateRolePermission: (param) => request.post(`${api}/role/updateRolePermission`, param).then(res => res?.data), // 更新角色与权限的绑定关系
    roleDelete: (roleId) => request.get(`${api}/role/remove?roleId=${roleId}`).then(res => res?.data), // 角色删除
    delPermission:(permissionId) => request.get(`${api}/role/permission/remove?permissionId=${permissionId}`), // 移除权限资源
    addPermission:(param) => request.post(`${api}/role/permission/create`,param), // 创建权限资源
    editPermission:(param) => request.post(`${api}/role/permission/update`,param), // 更新权限资源
    getUserPermission:() => request.get(`${api}/role/getUserPermission`), // 获取用户的权限信息
  }
}

export default systemApi
